<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page
	import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@ page import="org.springframework.context.ApplicationContext"%>
<%@ page import="com.shiplanet.service.CategoryService"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%
	ServletContext sc = this.getServletConfig().getServletContext();
	ApplicationContext ac2 = WebApplicationContextUtils
			.getWebApplicationContext(sc);
	CategoryService categoryService = (CategoryService) ac2
			.getBean("categoryService");
	request.setAttribute("categoryMap",
			categoryService.getCategoryNameMap(true, false));
%>

<section class="background-page">
	<div class="row padding-top">

		<tiles:insertAttribute name="adminmenu" />

		<article class="column custom-main-column">

			<div id="top" class="row collapse">
				<div class="column large-12">

					<s:form action="updatePost" namespace="/admin"
						enctype="multipart/form-data" method="post"
						cssClass="custom ng-pristine ng-valid" theme="simple">

						<div class="row">
							<div
								class="box-shadow background-white more-margin-bottom clearfix card content-padding">
								<div
									class="large-12 clearfix blue-topper heading-padding card-header">
									<h3 class="inverse no-margin-top no-margin-bottom">
										<span class="semi-bold"><em>Post Description</em></span>
									</h3>
								</div>
								<div class="column large-4 small-margin-top">
									<p class="gray italic">Give your equipment post an
										appropriate title and description to display on our site.</p>
								</div>

								<div class="column large-8 small-margin-top small-margin-bottom">
									<div class="form-row rp_listing_details_name">
										<label for="rp_listing_details_name" class="required">Equipment
											Name</label>
										<div id="rp_listing_details_name" class="form-widget">
											<s:textfield name="post.equipmentName"
												id="rp_listing_details_name" required="required" />
										</div>
										<div rel="rp_listing_details_name" class="helper required "></div>
									</div>
									<div class="form-row rp_listing_details_abstract">
										<label for="rp_listing_details_abstract" class="required">Title</label>
										<div id="rp_listing_details_abstract" class="form-widget">
											<s:textarea name="post.title"
												id="rp_listing_details_abstract" required="required" />
										</div>
										<div rel="rp_listing_details_abstract"
											class="helper required valid"></div>
									</div>
									<div class="form-row rp_listing_details_description">
										<label for="rp_listing_details_description" class="required">Description</label>
										<div id="rp_listing_details_description" rows="10"
											class="form-widget">
											<s:textarea name="post.equipmentDescription"
												id="rp_listing_details_description" required="required"
												rows="10" />
										</div>
										<div rel="rp_listing_details_description"
											class="helper required valid"></div>
									</div>
									<div class="form-row rp_listing_details_approve">
										<label for="rp_listing_details_approve" class="required">Is
											Approved</label>
										<div id="rp_listing_details_appprove" class="form-widget">
											<s:checkbox name="post.approved" />
										</div>
										<div rel="rp_listing_details_feature"
											class="helper required valid"></div>
									</div>
								</div>
							</div>
						</div>

						<div class="row collapse">
							<div
								class="box-shadow background-white more-margin-bottom clearfix card content-padding">
								<div
									class="large-12 clearfix blue-topper heading-padding card-header">
									<h3 class="inverse no-margin-top no-margin-bottom">
										<span class="semi-bold"><em>Optional Details</em></span>
									</h3>
								</div>
								<div class="column large-4 small-margin-top">
									<p class="gray italic">To help buyers narrow down their
										equipment search, fill out the following additional details
										about the equipment.</p>
								</div>

								<div class="column large-8 small-margin-top small-margin-bottom">
									<div class="form-row rp_listing_options_equipmentLocation">
										<label for="rp_listing_options_equipmentLocation">Location</label>
										<div id="rp_listing_options_equipmentLocation"
											class="form-widget">
											<s:textfield name="post.equipmentLocation"
												id="rp_listing_options_equipmentLocation" />
										</div>
										<div rel="rp_listing_options_askingPrice" class="helper  "></div>
									</div>
									<div class="form-row rp_listing_options_equipmentManufacturer">
										<label for="rp_listing_options_equipmentManufacturer">Manufacturer</label>
										<div id="rp_listing_options_equipmentManufacturer"
											class="form-widget">
											<s:textfield name="post.equipmentManufacturer"
												id="rp_listing_options_equipmentManufacturer"
												maxlength="100" />
										</div>
										<div rel="rp_listing_options_make" class="helper  "></div>
									</div>
									<div class="form-row rp_listing_options_itemno">
										<label for="rp_listing_options_itemno">Item Number</label>
										<div id="rp_listing_options_itemno" class="form-widget">
											<s:textfield name="post.equipmentItemNumber"
												id="rp_listing_options_model" maxlength="100" />
										</div>
										<div rel="rp_listing_options_itemno" class="helper  "></div>
									</div>
									<div class="form-row rp_listing_options_year">
										<label for="rp_listing_options_year">Year</label>
										<div id="rp_listing_options_year" class="form-widget">
											<s:textfield name="post.equipmentYear"
												id="rp_listing_options_year" />
										</div>
										<div rel="rp_listing_options_year" class="helper  "></div>
									</div>
									<div class="form-row rp_listing_details_featured">
										<label for="rp_listing_details_featured">Is Feature</label>
										<div id="rp_listing_details_featured" class="form-widget">
											<s:checkbox name="post.featured" />
										</div>
										<div rel="rp_listing_details_feature"
											class="helper required valid"></div>
									</div>
								</div>
							</div>
						</div>

						<div class="row collapse">
							<div
								class="box-shadow background-white more-margin-bottom clearfix card content-padding">
								<div
									class="large-12 clearfix blue-topper heading-padding card-header">
									<h3 class="inverse no-margin-top no-margin-bottom">
										<span class="semi-bold"><em>Your Notes</em></span>
									</h3>
								</div>
								<div class="column large-4 small-margin-top">
									<p class="gray italic">Only visible to you.</p>
								</div>

								<div class="column large-8 small-margin-top small-margin-bottom">
									<div class="form-row rp_listing_options_intermemo">
										<label for="rp_listing_options_intermemo">Notes</label>
										<div id="rp_listing_options_intermemo" class="form-widget">
											<s:textarea name="post.interMemo" id="rp_listing_options_intermemo" />
										</div>
										<div rel="rp_listing_options_intermemo" class="helper  "></div>
									</div>
								</div>
							</div>
						</div>

						<div class="row collapse">
							<div
								class="box-shadow background-white more-margin-bottom clearfix card content-padding">
								<div
									class="large-12 clearfix blue-topper heading-padding card-header">
									<h3 class="inverse no-margin-top no-margin-bottom">
										<span class="semi-bold"><em>Post Photo</em></span>
									</h3>
								</div>
								<div class="column large-4 small-margin-top">
									<p class="gray italic">Give the four photos as the Post
										cover.</p>
								</div>

								<div class="column large-8 small-margin-top small-margin-bottom">
									<div class="form-row rp_listing_options_photos">
										<label for="rp_listing_options_photos">Photos</label>
										<div id="rp_listing_options_photos" class="form-widget">
											<input type="file" id="rp_listing_options_photos"
												name="photoFiles" multiple="multiple" />
										</div>
										<div rel="rp_listing_options_photos" class="helper  "></div>
									</div>
								</div>
							</div>
						</div>

						<div class="row collapse">
							<button class="small right" id="payment-submit" type="submit">
								Save</button>
						</div>
						<s:hidden name="postId" value="%{ post.id }" />
					</s:form>

				</div>
			</div>

		</article>
	</div>
</section>